![Screenshot of the player](screenshot.png)

## Installation

You will need a relatively recent version of [Node.js](https://nodejs.org/en/), as well as [mpv](https://mpv.io/) (`apt install mpv` and the like work fine).

```
# Please do note --recursive. It clones git submodules.
git clone --recursive https://git.ed1.club/florrie/mtui.git  # Or https://notabug.org/towerofnix/mtui.git
cd mtui
npm install
npm link  # Or sudo npm link
mtui  # Or node .
```

Add music to the `~/Music` folder to make it show up in mtui, or pass `mtui` a
playlist.json file (usually generated by http-music or downloaded from online).

## Bugs or ideas?

Feel free and encouraged to report any bugs (unexpected behavior or crashes) to the [issue tracker on NotABug.org](https://notabug.org/towerofnix/mtui/issues)!
You're also welcome to share any ideas, suggestions, and questions through there.

## Keybindings

* <kbd><kbd>Ctrl</kbd>+<kbd>C</kbd></kbd> - exit
* <kbd>Up</kbd> and <kbd>Down</kbd> - select previous or next item in a listing
* <kbd>Tab</kbd> and <kbd><kbd>Shift</kbd>+<kbd>Tab</kbd></kbd> - switch between UI elements
* <kbd>1</kbd> - focus the main track/group listing
* <kbd>2</kbd> - focus the queue listing
* <kbd>Enter</kbd> - play the selected track
* <kbd><kbd>Shift</kbd>+<kbd>Up</kbd></kbd> or <kbd>p</kbd> - play previous track
* <kbd><kbd>Shift</kbd>+<kbd>Down</kbd></kbd> or <kbd>n</kbd> - play next track
* <kbd>Space</kbd> - toggle pause
* <kbd>Escape</kbd> - stop playing the current track
* <kbd>Right</kbd> - seek ahead
* <kbd>Left</kbd> - seek back
* <kbd><kbd>Ctrl</kbd>+<kbd>F</kbd></kbd> or <kbd>/</kbd> - jump to a track or group by entering (part of) its name
* <kbd><kbd>Ctrl</kbd>+<kbd>O</kbd></kbd> - open a playlist from a source (like a /path/to/a/folder or a YouTube playlist URL) (you can also just pass this source to `mtui`)
* <kbd>t</kbd> and <kbd>T</kbd> (shift+T) - switch between playlist tabs
* <kbd><kbd>Ctrl</kbd>+<kbd>T</kbd></kbd> - open the current playlist in a new tab (so, clone the current tab)
* <kbd><kbd>Ctrl</kbd>+<kbd>W</kbd></kbd> - close the current tab
* **In the main listing:**
  * <kbd>Enter</kbd> - if the selected item is a group, enter it; if it's a track, play it
  * <kbd>Backspace</kbd> - leave the current group (if in one)
  * <kbd>m</kbd> or <kbd>f</kbd> - open a menu of actions related to the selected track or group
  * <kbd>q</kbd> - queue the selected track or group to play after any other items in the queue (usually after the current track)
  * <kbd>Q</kbd> (shift+Q) - queue the selected track or group to play immediately after what's currently playing
  * <kbd>d</kbd> - download the selected track (but don't play it)
* **In the queue listing:**
  * <kbd>s</kbd> - shuffle the queue
  * <kbd>c</kbd> - clear the queue
  * <kbd>x</kbd> - remove the selected track from the queue
* **In path displays:** (Path displays are the things that show below the main and queue listings. They show the path of groups to the selected item in the listing.)
  * <kbd>Enter</kbd> or <kbd>Space</kbd> - view the selected item in the main listing
  * <kbd>Left</kbd> and <kbd>Right</kbd> - navigate the path display
* **In a context menu:**
  * All the usual controls (up, down, tab, space, enter) work
  * <kbd>Backspace</kbd> or <kbd>Escape</kbd> - close the menu without taking any action
